arch_template_string = _(u"Please select the architecture of the computer that gentoo will be installed on. For pentium and AMD 32-bit processors, choose x86. If you don't know your architecture, you should consider another Linux distribution.")
if self._d.yesno(_(u"Do you want debugging output enabled during the install? This is mainly meant to help the developers debug any bugs."), width=60) == self._DLG_YES:
root_mount_point_string = _(u"Enter the mount point to be used to mount the partition(s) where the new system will be installed. The default is /mnt/gentoo and is greatly recommended, but any mount point will do.")
choice_list.append(("Other",_(u"Type your own.")))
cnet_string1 = _(u"In order to complete most installs, an active Internet connection is required. Listed are the network devices already detected. In this step you will need to setup one network connection for GLI to use to connect to the Internet. If your desired device does not show up in the list, you can select Other and input the device name manually.")
cnet_string2 = _(u"To setup your network interface, you can either use DHCP if enabled, or manually enter your network information.\n DHCP (Dynamic Host Configuration Protocol) makes it possible to automatically receive networking information (IP address, netmask, broadcast address, gateway, nameservers etc.). This only works if you have a DHCP server in your network (or if your provider provides a DHCP service). If you do not, you must enter the information manually. Please select your networking configuration method:")
if self._d.yesno(cnet_string2, height=15, width=60) == self._DLG_YES: #DHCP
network_type = 'dhcp'
code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50)
else:
network_type = 'static'
code, data = self._d.form(_(u'Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields you intend to fill out are complete!'),
((_(u'Enter your IP address:'), 15),
(_(u'Enter your Broadcast address:'), 15),
(_(u'Enter your Netmask:'),15,'255.255.255.0'),
(_(u'Enter your default gateway:'),15),
(_(u'Enter a DNS server:'),15,'128.118.25.3'),
(_(u'Enter a HTTP Proxy IP:'), 15,self._client_profile.get_http_proxy()),
(_(u'Enter a FTP Proxy IP:'), 15, self._client_profile.get_ftp_proxy()),
(_(u'Enter a RSYNC Proxy:'),15,self._client_profile.get_rsync_proxy())
if self._d.yesno(_(u"Do you want SSH enabled during the install? This will allow you to login remotely during the installation process. If choosing Yes, be sure you select a new LiveCD root password!"), width=60) == self._DLG_YES:
cmodules_string1 = _(u"Here is a list of modules currently loaded on your machine.\n Please look through and see if any modules are missing\n that you would like loaded.\n\n")
cmodules_string2 = _(u"\nIf you have additional modules you would like loaded before the installation begins (ex. a network driver), enter them in a space-separated list.")
#choice_list.append(("Other", "Type your own drive name)) # I DONT THINK GLISD CAN DO NONEXISTANT DRIVES
while 1:
code, drive_to_partition = self._d.menu(_(u"Which drive would you like to partition?\n Info provided: Type, mkfs Options, Mountpoint, Mountopts, Size in MB"), choices=choice_list, cancel=_(u"Save and Continue"))
self._d.msgbox(_(u"ERROR: could not clear the partition table!"))
continue
#all other cases (partitions)
part_to_edit = partlist[int(part_to_edit)-1]
tmppart = tmpparts[part_to_edit]
if tmppart.get_type() == "free":
# partition size first
free_mb = tmppart.get_mb()
code, new_mb = self._d.inputbox(_(u"Enter the size of the new partition in MB (max %s MB). If creating an extended partition input its entire size (not just the first logical size):") % str(free_mb), init=str(free_mb))
if code != self._DLG_OK: continue
if int(new_mb) > free_mb:
self._d.msgbox(_(u"The size you entered (%s MB) is larger than the maximum of %s MB") % (new_mb, str(free_mb)))
continue
# partition type
part_types = [("ext2", _(u"Old, stable, but no journaling")),
("ext3", _(u"ext2 with journaling and b-tree indexing (RECOMMENDED)")),
("linux-swap", _(u"Swap partition for memory overhead")),
("fat32", _(u"Windows filesystem format used in Win9X and XP")),
("ntfs", _(u"Windows filesystem format used in Win2K and NT")),
code, mountpt = self._d.menu(_(u"Choose a mountpoint from the list or choose Other to type your own for partition ")+str(part_to_edit)+_(u". It is currently set to:")+tmppart.get_mountpoint(), choices=self._dmenu_list_to_choices(mountpoint_menu)) #may have to make that an integer
if code == self._DLG_OK:
mountpt = mountpoint_menu[int(mountpt)-1]
if mountpt == _(u"Other"):
code, mountpt = self._d.inputbox(_(u"Enter a mountpoint for partition ") + str(part_to_edit), init=tmppart.get_mountpoint())
try: tmppart.set_mountpoint(mountpt)
except: self._d.msgbox(_(u"ERROR! Could not set mountpoint!"))
elif part_action == _(u"Mount Options"):
code, answer = self._d.inputbox(_(u"Enter your mount options for partition ") + str(part_to_edit), init=(tmppart.get_mountopts() or "defaults"))
if code == self._DLG_OK: tmppart.set_mountopts(answer)
code, menuitemidx = self._d.menu(_(u"If you have any network shares you would like to mount during the install and for your new system, define them here. Select a network mount to edit or add a new mount. Currently GLI only supports NFS mounts."), choices=choices, cancel=_(u"Save and Continue"), height=18)
code, mountpoint = self._d.inputbox(_(u"Enter a mountpoint"), init=tmpmount['mountpoint'])
if code == self._DLG_OK:
tmpmount['mountpoint'] = mountpoint
code, mountopts = self._d.inputbox(_(u"Enter mount options"), init=tmpmount['mountopts'])
if code == self._DLG_OK:
tmpmount['mountopts'] = mountopts
network_mounts[int(menuitemidx)-1] = tmpmount
def set_install_stage(self):
# The install stage and stage tarball will be selected here
install_stages = (("1",_(u"Stage1 is used when you want to bootstrap&build from scratch.")),
("2",_(u"Stage2 is used for building from a bootstrapped semi-compiled state.")),
("3",_(u"Stage3 is a basic system that has been built for you (no compiling).")),
("3+GRP", _(u"A Stage3 install but using binaries from the LiveCD when able.")))
code, install_stage = self._d.menu(_(u"Which stage do you want to start at?"), choices=install_stages, cancel=_(u"Back"), width=78)
stage3warning = ""
if code == self._DLG_OK:
if install_stage == "3+GRP":
stage3warning = "\nWARNING: Since you are doing a GRP install it is HIGHLY recommended you choose Create from CD to avoid a potentially broken installation."
if self._d.yesno(_(u"Do you want to generate a stage3 on the fly using the files on the LiveCD (fastest) or do you want to grab your stage tarball from the Internet?"+stage3warning), width=55) == self._DLG_YES:
if GLIUtility.ping("www.gentoo.org"): #Test for network connectivity
mirrors = GLIUtility.list_mirrors()
mirrornames = []
mirrorurls = []
for item in mirrors:
mirrornames.append(item[1])
mirrorurls.append(item[0])
code, mirror = self._d.menu(_(u"Select a mirror to grab the tarball from or select Cancel to enter an URI manually."), choices=self._dmenu_list_to_choices(mirrornames), width=77, height=20)
code, subarch = self._d.menu(_(u"Select the sub-architecture that most closely matches your system (this changes the amount of optimization):"), choices=self._dmenu_list_to_choices(subarches))
self._d.msgbox(_(u"ERROR! Could not set the portage cd snapshot URI!"))
return
#Normal case
menulist = [("Sync", _(u"Normal. Use emerge sync RECOMMENDED!")),
("Webrsync", _(u"HTTP daily snapshot. Use when rsync is firewalled.")),
("Snapshot", _(u"Use a portage snapshot, either a local file or a URL")),
("None", _(u"Extra cases such as if /usr/portage is an NFS mount"))]
code, portage_tree_sync = self._d.menu(_(u"Which method do you want to use to sync the portage tree for the installation? If choosing a snapshot you will need to provide the URI for the snapshot if it is not on the livecd."),width=75, height=17, choices=menulist)
use_flags.append((flagname, use_desc[flagname], int(flagname in system_use_flags)))
#present the menu
code, use_flags = self._d.checklist(_(u"Choose which *global* USE flags you want on the new system"), height=25, width=80,list_height=17, choices=use_flags)
#populate the chocies list
sorted_use = use_local_desc.keys()
sorted_use.sort()
for flagname in sorted_use:
use_local_flags.append((flagname, use_local_desc[flagname], int(flagname in system_use_flags)))
#present the menu
code, use_local_flags = self._d.checklist(_(u"Choose which *local* USE flags you want on the new system"), height=25, width=80,list_height=17, choices=use_local_flags)
temp_use = "-* "
for flag in use_flags:
temp_use += flag + " "
for flag in use_local_flags:
temp_use += flag + " "
make_conf["USE"] = temp_use
if not self._install_profile.get_dynamic_stage3() and self.advanced_mode:
#Second, set the ACCEPT_KEYWORDS
#Change the Yes/No buttons to new labels for this question.
if self._d.yesno(_(u"Do you want to run the normal stable portage tree, or the bleeding edge unstable (i.e. ACCEPT_KEYWORDS=arch)? If unsure select stable. Stable is required for GRP installs."), height=12, width=55) == self._DLG_YES:
("GENTOO_MIRRORS", _(u"Specify mirrors to use for source retrieval.")),
("SYNC", _(u"Specify server used by rsync to sync the portage tree.")),
(_(u"Other"), _(u"Specify your own variable and value."))]
code, menuitem = self._d.menu(_(u"For experienced users, the following /etc/make.conf variables can also be defined. Choose a variable to edit or Done to continue."), choices=menulist, cancel=_(u"Done"), width=77)
if code != self._DLG_OK:
break
if menuitem == _(u"Other"):
code,menuitem = self._d.inputbox(_(u"Enter the variable name: "))
if code != self._DLG_OK:
continue
oldval = ""
if make_conf.has_key(menuitem):
oldval = make_conf[menuitem]
if oldval:
code, newval = self._d.inputbox(_(u"Enter new value for ") + menuitem, init=oldval)
code, choice = self._d.menu(_(u"Choose a flag to add to the CFLAGS variable or Done to go back. The current value is: ")+ cflags, choices=choices_list, cancel=_(u"Done"), width=70)
if code != self._DLG_OK:
break
if choice == "CLEAR":
cflags = ""
elif choice == _(u"Manual"):
code, cflags = self._d.inputbox(_(u"Enter new value for ") + menuitem)
break
elif choice in ["-fomit-frame-pointer","-pipe"]:
cflags += " "+choice
else:
code, newval = self._d.inputbox(_(u"Enter the new value for %s (value only):") % choice)
code, chost = self._d.menu(_(u"Choose from the available CHOSTs for your architecture."), choices=self._dmenu_list_to_choices(choices_list), width=77)
if code != self._DLG_OK:
continue
chost = choices_list[int(chost)-1]
make_conf['CHOST'] = chost
elif menuitem == "MAKEOPTS":
makeopt_string = _(u"Presently the only use is for specifying the number of parallel makes (-j) to perform. The suggested number for parallel makes is CPUs+1. Enter the NUMBER ONLY:")
choices_list = [("sandbox",_(u"enables sandboxing when running emerge and ebuild."),0),
("ccache",_(u"enables ccache support via CC."),0),
("distcc",_(u"enables distcc support via CC."),0),
("distlocks",_(u"enables distfiles locking using fcntl or hardlinks."),0),
("buildpkg",_(u"create binaries of all packages emerged"),0),
(_(u"Other"),_(u"Input your list of FEATURES manually."),0) ]
features_string = _(u"FEATURES are settings that affect the functionality of portage. Most of these settings are for developer use, but some are available to non-developers as well.")
if self._d.yesno(_(u"Do you want to use distcc to compile your extra packages during the install and for future compilations as well?"), height=12, width=60) == self._DLG_YES:
("portage/package.use",_(u"Per-package USE flags.")),
(_(u"Other"),_(u"Type your own name of a file to edit in /etc/"))]
code, menuitem = self._d.menu(_(u"For experienced users, the following /etc/* variables can also be defined. Choose a variable to edit or Done to continue."), choices=menulist, cancel=_(u"Done"), width=77)
if code != self._DLG_OK:
break #get out of the while loop. then save and continue
if menuitem == _(u"Other"):
code, menuitem = self._d.inputbox(_(u"Enter the name of the /etc/ file you would like to edit (DO NOT type /etc/)"))
if code != self._DLG_OK:
return
oldval = ""
if etc_files.has_key(menuitem):
oldval = etc_files[menuitem]
code, newval = self._d.inputbox(_(u"Enter new contents (use \\n for newline) of ") + menuitem, init=oldval)
if code == self._DLG_OK:
etc_files[menuitem] = []
etc_files[menuitem].append(newval)
try:
self._install_profile.set_etc_files(etc_files)
except:
self._d.msgbox(_(u"ERROR! Could not set etc/portage/* correctly!"))
def set_kernel(self):
# This section will be for choosing kernel sources, choosing (and specifying) a custom config or genkernel, modules to load at startup, etc.
kernel_sources = [("livecd-kernel", _(u"Copy over the current running kernel (fastest)")),
("vanilla-sources", _(u"The Unaltered Linux Kernel ver 2.6+ (safest)")),
("hardened-sources", _(u"Hardened sources for the 2.6 kernel tree")),
("grsec-sources",_(u"Vanilla sources with grsecurity patches")),
(_(u"Other"), _(u"Choose one of the other sources available."))]
code, menuitem = self._d.menu(_(u"Choose which kernel sources to use for your system. If using a previously-made kernel configuration, make sure the sources match the kernel used to create the configuration."), choices=kernel_sources, width=77, height=17)
if code != self._DLG_OK:
return
if menuitem == _(u"Other"):
code, menuitem = self._d.inputbox(_(u"Please enter the desired kernel sources package name:"))
self._d.add_persistent_args(["--no-label", _(u"Traditional (requires a config!)")])
kernel_string1 = _(u"There are currently two ways the installer can compile a kernel for your new system. You can either provide a previously-made kernel configuration file and use the traditional kernel-compiling procedure (no initrd) or have genkernel automatically create your kernel for you (with initrd). \n\n If you do not have a previously-made kernel configuration, YOU MUST CHOOSE Genkernel. Choose which method you want to use.")
if self._d.yesno(kernel_string1, width=76,height=13) == self._DLG_YES: #Genkernel
code, custom_kernel_uri = self._d.inputbox(_(u"If you have a custom kernel configuration, enter its location (otherwise just press Enter to continue):"), height=13, width=50)
if code == self._DLG_OK:
if custom_kernel_uri:
if not GLIUtility.is_uri(custom_kernel_uri, checklocal=self.local_install):
self._d.msgbox(_(u"The specified URI is invalid. It was not saved. Please go back and try again."))
("lilo",_(u"LInux LOader, older, traditional.(detects windows partitions)"))],
'amd64': [
("grub",_(u"GRand Unified Bootloader, newer, RECOMMENDED"))]} #FIXME ADD OTHER ARCHS
boot_loaders = arch_loaders[arch]
boot_loaders.append(("none", _(u"Do not install a bootloader. (System may be unbootable!)")))
boot_string1 = _(u"To boot successfully into your new Linux system, a bootloader will be needed. If you already have a bootloader you want to use you can select None here. The bootloader choices available are dependent on what GLI supports and what architecture your system is. Choose a bootloader")
boot_string2 = _(u"Most bootloaders have the ability to install to either the Master Boot Record (MBR) or some other partition. Most people will want their bootloader installed on the MBR for successful boots, but if you have special circumstances, you can have the bootloader installed to the /boot partition instead. Do you want the boot loader installed in the MBR? (YES is RECOMMENDED)")
if self._d.yesno(boot_string2, height=13, width=55) == self._DLG_YES:
if self._install_profile.get_boot_loader_mbr(): #If we're installing to MBR gotta check the device.
if self.advanced_mode or (boot_device[-1] != 'a'):
#show the menu.
boot_string3_std = _(u"Your boot device may not be correct. It is currently set to %s, but this device may not be the first to boot. Usually boot devices end in 'a' such as hda or sda.") % boot_device
boot_string3 = _(u" Please confirm your boot device by choosing it from the menu.")
if not self.advanced_mode:
boot_string3 = boot_string3_std + boot_string3
#grab choies from the partiton list.
boot_drive_choices = []
for device in parts:
boot_drive_choices.append(device)
if not boot_drive_choices:
self._d.msgbox(_(u"ERROR: No drives set up. Please complete the Partitioning screen first!"))
self._d.msgbox(_(u"ERROR! Could not set the boot device!")+boot_drive_choice)
if self.advanced_mode:
code, bootloader_kernel_args = self._d.inputbox(_(u"If you have any additional optional arguments you want to pass to the kernel at boot, type them here or just press Enter to continue:"), height=12, width=55)
if os.path.isdir(zonepath + "/" + entry): entry += "/"
tzlist.append(entry)
tzlist.sort()
timezone_string = _(u"Please select the timezone for the new installation. Entries ending with a / can be selected to reveal a sub-list of more specific locations. For example, you can select America/ and then Chicago.")
net_string1 = _(u"Here you will enter all of your network interface information for the new system. You can either choose a network interface to edit, add a network interface, delete an interface, or edit the miscellaneous options such as hostname and proxy servers.")
net_string2 = _(u"To setup your network interface, you can either use DHCP if enabled, or manually enter your network information.\n DHCP (Dynamic Host Configuration Protocol) makes it possible to automatically receive networking information (IP address, netmask, broadcast address, gateway, nameservers etc.). This only works if you have a DHCP server in your network (or if your provider provides a DHCP service). If you do not, you must enter the information manually. Please select your networking configuration method:")
newchoice_list.append((_(u"Other"),_(u"Type your own.")))
code, newnic = self._d.menu(_("Choose an interface from the list or Other to type your own if it was not detected."), choices=newchoice_list, width=75)
else:
newnic == _(u"Other")
if newnic == _(u"Other"):
code, newnic = self._d.inputbox(_(u"Enter name for new interface (eth0, ppp0, etc.)"))
if code != self._DLG_OK:
continue
if newnic in interfaces:
self._d.msgbox(_(u"An interface with the name is already defined."))
continue
#create the interface in the data structure.
#interfaces[newnic] = ("", "", "")
#Change the Yes/No buttons to new labels for this question.
if self._d.yesno(net_string2, height=15, width=60) == self._DLG_YES: #DHCP
dhcp_options = ""
if self.advanced_mode:
code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50)
interfaces[newnic] = ('dhcp', dhcp_options, None)
else:
network_type = 'static'
code, data = self._d.form(_(u'Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields are complete!'),
if self._d.yesno(_(u"For interface %s, you can either edit the interface information (IP Address, Broadcast, Netmask) or Delete the interface.") % iface_choice) == self._DLG_YES:
#Edit
#Change the Yes/No buttons to new labels for this question.
if self._d.yesno(net_string2, height=15, width=60) == self._DLG_YES: #DHCP
dhcp_options = ""
if self.advanced_mode:
code, dhcp_options = self._d.inputbox(_(u"If you have any additional DHCP options to pass, type them here in a space-separated list. If you have none, just press Enter."), height=13, width=50)
code, data = self._d.form(_(u'Enter your networking information: (See Chapter 3 of the Handbook for more information) Your broadcast address is probably your IP address with 255 as the last tuple. Do not press Enter until all fields are complete!'),
((_(u'Enter your IP address:'), 15, interfaces[iface_choice][0]),
(_(u'Enter your Broadcast address:'), 15, interfaces[iface_choice][1]),
(_(u'Enter your Netmask:'),15,interfaces[iface_choice][2])))
net_string3 = _("To be able to surf on the internet, you must know which host shares the Internet connection. This host is called the gateway. It is usually similar to your IP address, but ending in .1\nIf you have DHCP then just select your primary Internet interface (no IP will be needed) Start by choosing which interface accesses the Internet:")
self._d.msgbox(_(u"ERROR! Coult not set the default gateway with IP %s for interface %s") % (ip, gateway_iface))
break
#Now ask for the other info in a large form.
error = True
hostname = ""
domainname = ""
nisdomainname = ""
primary_dns = ""
backup_dns = ""
http_proxy = ""
ftp_proxy = ""
rsync_proxy = ""
while error:
error = False
if self.advanced_mode:
code, data = self._d.form(_(u'Fill out the remaining networking settings. The hostname is manditory as that is the name of your computer. Leave the other fields blank if you are not using them. If using DHCP you do not need to enter DNS servers. Do not press Enter until all fields are complete!'),
((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),
(_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),
(_(u'Enter your NIS Domain Name:'),25,self._install_profile.get_nisdomainname()),
(_(u'Enter a primary DNS server:'),15),
(_(u'Enter a backup DNS server:'),15),
(_(u'Enter a HTTP Proxy IP:'), 15,self._install_profile.get_http_proxy()),
(_(u'Enter a FTP Proxy IP:'), 15, self._install_profile.get_ftp_proxy()),
(_(u'Enter a RSYNC Proxy:'),15,self._install_profile.get_rsync_proxy())))
code, data = self._d.form(_(u'Fill out the remaining networking settings. The hostname is manditory as that is the name of your computer. Leave the other fields blank if you are not using them. If using DHCP you do not need to enter DNS servers. Do not press Enter until all fields are complete!'),
((_(u'Enter your Hostname:'), 25, self._install_profile.get_hostname()),
(_(u'Enter your Domain Name:'), 25, self._install_profile.get_domainname()),
("dcron",_(u"A cute little cron from Matt Dillon.")),
("fcron", _(u"A scheduler with extended capabilities over cron & anacron")),
("None", _(u"Don't use a cron daemon. (NOT Recommended!)")))
cron_string = _(u"A cron daemon executes scheduled commands. It is very handy if you need to execute some command regularly (for instance daily, weekly or monthly). Gentoo offers three possible cron daemons: dcron, fcron and vixie-cron. Installing one of them is similar to installing a system logger. However, dcron and fcron require an extra configuration command, namely crontab /etc/crontab. If you don't know what to choose, use vixie-cron. If doing a networkless install, choose vixie-cron. Choose your cron daemon:")
loggers = (("syslog-ng", _(u"An advanced system logger.")),
("metalog", _(u"A Highly-configurable system logger.")),
("syslogkd", _(u"The traditional set of system logging daemons.")))
logger_string = _(u"Linux has an excellent history of logging capabilities -- if you want you can log everything that happens on your system in logfiles. This happens through the system logger. Gentoo offers several system loggers to choose from. If you plan on using sysklogd or syslog-ng you might want to install logrotate afterwards as those system loggers don't provide any rotation mechanism for the log files. If doing networkless, choose syslog-ng. Choose a system logger:")
highlevel_menu.append( ("Manual", "Type your own space-separated list of packages.") )
while 1:
extra_string1 = _(u"There are thousands of applications available to Gentoo users through Portage, Gentoo's package management system. Select some of the more common ones below or add your own additional package list by choosing 'Manual'.")
code, submenu = self._d.menu(extra_string1+ _(u"\nYour current package list is: ")+string.join(install_packages, ','), choices=highlevel_menu, cancel=_(u"Save and Continue"), width=70, height=23)
self._d.msgbox(_(u"ERROR! Could not set the install packages! List of packages:"))
return
#Popular Desktop Applications
choices_list = []
#pkgs = {}
#Special case first.
if submenu == "Manual":
code, tmp_install_packages = self._d.inputbox(_(u"Enter a space-separated list of extra packages to install on the system"), init=string.join(install_packages, ' '), width=70)
if code == self._DLG_OK:
install_packages = tmp_install_packages.split()
continue
#All other cases load pkgs and GRP
pkgs = package_list[submenu][1]
grp_list = GLIUtility.get_grp_pkgs_from_cd()
for pkg in pkgs:
if pkg in grp_list:
choices_list.append((pkg, "(GRP) "+pkgs[pkg], int(pkg in install_packages)))
else:
choices_list.append((pkg, pkgs[pkg], int(pkg in install_packages)))
code, choices = self._d.checklist(_(u"Choose from the listed packages. If doing a networkless install, only choose (GRP) packages."), choices=choices_list, height=19, list_height=10, width=77)
if code != self._DLG_OK:
continue
for pkg in pkgs: #clear out packages from this list that are already in install_packages so that you can uncheck packages and they will be removed. the ones that remain checked will be re-added.
for i, tmppkg in enumerate(install_packages):
if tmppkg == pkg:
del install_packages[i]
for package in choices:
install_packages.append(package)
#special cases for desktop environments
if package in ["xorg-x11", "gnome","kde","blackbox","enlightenment","fluxbox","xfce4"]: #ask about X
choice_list = [("alsasound", _(u"ALSA Sound Daemon"),int("alsasound" in services)),
("apache", _(u"Common web server (version 1.x)"),int("apache" in services)),
("apache2", _(u"Common web server (version 2.x)"),int("apache2" in services)),
("distccd", _(u"Distributed Compiling System"),int("distccd" in services)),
("esound", _(u"ESD Sound Daemon"),int("esound" in services)),
("hdparm", _(u"Hard Drive Tweaking Utility"),int("hdparm" in services)),
("local", _(u"Run scripts found in /etc/conf.d/local.start"),int("local" in services)),
("portmap", _(u"Port Mapping Service"),int("portmap" in services)),
("proftpd", _(u"Common FTP server"),int("proftpd" in services)),
("sshd", _(u"SSH Daemon (allows remote logins)"),int("sshd" in services)),
("xfs", _(u"X Font Server"),int("xfs" in services)),
("xdm", _(u"X Daemon"),int("xdm" in services)),
(_(u"Other"),_(u"Manually specify your services in a comma-separated list."),0)]
services_string = _(u"Choose the services you want started on bootup. Note that depending on what packages are selected, some services listed will not exist.")
self._d.msgbox(_(u"ERROR! Could not set the services list."))
return
def set_rc_conf(self):
# This section is for editing /etc/rc.conf
if not self.advanced_mode:
return
etc_files = self._install_profile.get_etc_files()
keymap = ""
windowkeys = ""
ext_keymap = ""
font = ""
trans = ""
clock = ""
editor = ""
disp_manager = ""
xsession = ""
rc_string1 = _(u"Additional configuration settings for Advanced users (rc.conf)\nHere are some other variables you can set in various configuration files on the new system. If you don't know what a variable does, don't change it!")
menulist = [("KEYMAP",_(u"Use KEYMAP to specify the default console keymap.")),
("SET_WINDOWSKEYS", _(u"Decision to first load the 'windowkeys' console keymap")),
("EXTENDED_KEYMAPS", _(u"maps to load for extended keyboards. Most users will leave this as is.")),
("CONSOLEFONT", _(u"Specifies the default font that you'd like Linux to use on the console.")),
("CONSOLETRANSLATION", _(u"The charset map file to use.")),
("CLOCK", _(u"Set the clock to either UTC or local")),
("EDITOR", _(u"Set EDITOR to your preferred editor.")),
("DISPLAYMANAGER", _(u"What display manager do you use ? [ xdm | gdm | kdm | entrance ]")),
("XSESSION", _(u"a new variable to control what window manager to start default with X"))]
while 1:
code, variable = self._d.menu(rc_string1, choices=menulist, cancel=_(u"Save and Continue"), width=77, height=19)
if code != self._DLG_OK:
break
if variable == "KEYMAP":
keymap_list = GLIUtility.generate_keymap_list()
code, keymap = self._d.menu(_(u"Choose your desired keymap:"), choices=self._dmenu_list_to_choices(keymap_list), height=19)
if self._d.yesno(_(u"Should we first load the 'windowkeys' console keymap? Most x86 users will say 'yes' here. Note that non-x86 users should leave it as 'no'.")) == self._DLG_YES:
windowkeys = "yes"
else:
windowkeys = "no"
elif variable == "EXTENDED_KEYMAPS":
code, ext_keymap = self._d.inputbox(_(u"This sets the maps to load for extended keyboards. Most users will leave this as is. Enter new value for EXTENDED_KEYMAPS"), width=60)
code, editor = self._d.menu(_(u"Choose your default editor: "), choices=choice_list)
elif variable == "DISPLAYMANAGER":
choice_list = [("xdm", _(u"X Display Manager")),
("gdm", _(u"Gnome Display Manager")),
("kdm", _(u"KDE Display Manager")),
("entrance", _(u"Login Manager for Enlightenment"))]
code, disp_manager = self._d.menu(_(u"Choose your desired display manager to use when starting X (note you must make sure that package also gets installed for it to work):"), choices=choice_list, width=65)
elif variable == "XSESSION":
code, xsession = self._d.inputbox(_(u"Choose what window manager you want to start default with X if run with xdm, startx, or xinit. (common options are Gnome or Xsession:"), width=65, height=12)
code, passwd1 = self._d.passwordbox(_(u"Please enter your desired password for the root account. (note it will not show the password. Also do not try to use backspace.):"))
if code != self._DLG_OK:
return
code, passwd2 = self._d.passwordbox(_(u"Enter the new root password again for confirmation"))
if code != self._DLG_OK:
return
if passwd1 != passwd2:
self._d.msgbox(_(u"The passwords do not match. Please try again or cancel."))
users_string1 = _(u"Working as root on a Unix/Linux system is dangerous and should be avoided as much as possible. Therefore it is strongly recommended to add a user for day-to-day use. Choose a user to edit:")
code, menuitem = self._d.menu(users_string1, choices=self._dmenu_list_to_choices(menu_list), cancel="Save and Continue", height=19)
if code != self._DLG_OK:
#if self._d.yesno("Do you want to save changes?") == self._DLG_YES:
tmpusers = []
for user in users:
tmpusers.append(users[user])
try:
self._install_profile.set_users(tmpusers)
except:
self._d.msgbox(_(u"ERROR! Could not set the additional users!"))
break
menuitem = menu_list[int(menuitem)-1]
if menuitem == _(u"Add user"):
code, newuser = self._d.inputbox(_(u"Enter the username for the new user"))
if code != self._DLG_OK:
continue
if newuser in users:
self._d.msgbox(_(u"A user with that name already exists"))
continue
code, passwd1 = self._d.passwordbox(_(u"Enter the new password for user ")+ newuser)
code, passwd2 = self._d.passwordbox(_(u"Enter the new password again for confirmation"))
if code == self._DLG_OK:
if passwd1 != passwd2:
self._d.msgbox(_(u"The passwords do not match! Go to the menu and try again."))
code, groups = self._d.inputbox(_(u"Enter a comma-separated list of groups the user is to be in"), init=",".join(users[menuitem][2]))
if code != self._DLG_OK: continue
users[menuitem][2] = string.split(groups, ",")
elif menuitem2 == _(u"Shell"):
code, shell = self._d.inputbox(_(u"Enter the shell you want the user to use. default is /bin/bash. "), init=users[menuitem][3])
if code != self._DLG_OK:
continue
users[menuitem][3] = shell
elif menuitem2 == _(u"Home Directory"):
code, homedir = self._d.inputbox(_(u"Enter the user's home directory. default is /home/username. "), init=users[menuitem][4])
if code != self._DLG_OK:
continue
users[menuitem][4] = homedir
elif menuitem2 == _(u"UID"):
code, uid = self._d.inputbox(_(u"Enter the user's UID. If left blank the system will choose a default value (this is recommended)."), init=users[menuitem][5], height=11, width=55)
if code != self._DLG_OK:
continue
if type(uid) != int:
continue
users[menuitem][5] = uid
elif menuitem2 == _(u"Comment"):
code, comment = self._d.inputbox(_(u"Enter the user's comment. This is completely optional."), init=users[menuitem][6])